package com.kfm.base.ex;

public class Demo05 {

    public static void main(String[] args) {

//        try {
//            int a = 5 / 0;
//            System.out.println("try");
//        } catch (Exception ex){
//            System.out.println("异常");
//        } finally {
//            System.out.println("finally");
//        }
//
//
//        System.out.println("end");
//
        int result = value();
        System.out.println(result); // 0 3

//        List list = new List();

//        list.get(1);
    }


    public static int value() {
        try {
            int a = 3 / 0;
            return a;
        } catch (Exception e) { // Exception e = 异常对象;
            System.out.println(e);
            String cause = e.getMessage();
            System.out.println(cause);
            e.printStackTrace(); // 打印异常栈信息

            System.out.println("异常" );
            return -1;
        } finally {
            System.out.println("finally");
            return 0;
        }
    }
}
